package com.xyz.xservice.modules.demo.mapper;

import com.xyz.xservice.modules.demo.entity.DemoUser;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DemoUserMapper {

    @Select("SELECT * FROM user")
    List<DemoUser> selectUsers();

    @Insert("INSERT INTO user (name,age) values (#{name},#{age})")
    boolean addUser(@Param("name") String name, @Param("age") Integer age);

    @Insert("INSERT INTO t_order (order_id,name,user_id) values (#{name},#{userId})")
    boolean addUserOrder(@Param("order_id") Long order_id,@Param("name") String name, @Param("userId") Integer userId);

    @Delete("DELETE from user where id = #{id}")
    void deleteUserById(Long id);
}
